In [2]:
    
def get_matching_words(center_letter, other_letters, min_word_length=5):
    words = []
    allowed_letters = set(center_letter).union(set(other_letters))
    with open('/usr/share/dict/american-english', 'r') as f:
        for word in f:
            word = word.strip().lower()
            if len(word) < min_word_length:
                continue
            if center_letter not in word:
                continue
            if set(word).difference(allowed_letters):
                # the word contains letters other than the allowed letters
                continue
            words.append(word)
    return words
matching_words = get_matching_words('t', ('a', 'b', 'e', 'k', 'm', 'n'))
matching_words
    
    Out[2]:
In [ ]:
    
    
In [ ]: